//
//  MTNavigationController.m
//  ebook
//
//  Created by 吴超飞 on 16/1/14.
//  Copyright © 2016年 Moton. All rights reserved.
//

#import "MTNavigationController.h"
#import "ReaderViewController.h"
#import "CatchCrash.h"
#import "MTMineViewController.h"

@interface MTNavigationController ()<UINavigationControllerDelegate>

@end

@implementation MTNavigationController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.delegate = self;
    self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
    
    //注册消息处理函数的处理方法
    NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (UIStatusBarStyle)preferredStatusBarStyle {
   
    return UIStatusBarStyleLightContent;
}

-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    
    [super pushViewController:viewController animated:YES];
}

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
    if ([viewController isKindOfClass:[ReaderViewController class]]||[viewController isKindOfClass:[MTMineViewController class]]) {
        [navigationController setNavigationBarHidden:YES animated:animated];
    }else{
        [navigationController setNavigationBarHidden:NO animated:animated];
    }    
}

@end
